﻿using UnityEngine;
using System.Collections;
using UnityEngine.UI;
using System.Collections.Generic;

public class LoginManager : MonoBehaviour {

    Button[] buttonArray = new Button[4];

	// Use this for initialization
	void Start ()
    {
        for (int i=0;i < buttonArray.Length;i ++)
        {
            buttonArray[i] = transform.GetChild(i).GetComponent<Button>();
            Button thisButton = buttonArray[i];
            thisButton.onClick.AddListener(delegate (){
                LoginSceneOnClick(thisButton.gameObject);



            });

        }

    }
    void LoginSceneOnClick(GameObject button)
    {
        switch (button.name) {
            case "wx_login":
                print("微信登录");
                break;

            case "xl_login":
                print("闲聊登录");
                break;
            case "text_read":
                GameObject UserAgreementPanel = (GameObject)Instantiate(Resources.Load("Prefabs/userAgreementPanel"));
                GameObject mUICanvas = GameObject.Find("Canvas");
                UserAgreementPanel.transform.parent = mUICanvas.transform;
                UserAgreementPanel.transform.localPosition = Vector3.zero;


                print("打开用户协议");
                break;
            case "check_box":
                print("勾选框");
                break;

        }

    }
	// Update is called once per frame
	void Update () {
	
	}
}
